
<h3 class="page-title">
    角色管理
</h3>
<div class="container-fluid" ng-show="!roleGrid.edit">
    <div class="col-md-4 portlet">
        <div class="portlet-title">
            <div class="caption">
                <span>部门</span>
                <button ed-auth="auth" class="btn btn-success" ng-click="reloadDataScope()"><i class="fa fa-plus"></i> 刷新权限 </button>
            </div>
        </div>
        <div class="portlet-body">
            <div ed-dept-tree ed-click="selectDept" style="height:450px; overflow:auto;"></div>
        </div>
    </div>
    <div class="col-md-8">
        <div class="portlet-title">
            <div class="caption" style="height: 34px;line-height: 34px">
                角色列表
                <button ed-auth="add" class="btn btn-success" ng-click="roleGrid.add()" ng-show="dept"><i class="fa fa-plus"></i> 新增 </button>
            </div>
        </div>
        <div class="portlet-body">
            <table ed-grid="roleGrid" class="table table-striped table-bordered table-advance table-hover"
                   ed-url="role/query.do" ed-model="role">
                <thead>
                <tr>
                    <th ed-data="roleName">角色名称</th>
                    <th ed-data="deptName">所属部门</th>
                    <th ed-data="roleScope | code: 'rolescope'">数据范围</th>
                    <th ed-data="remark">备注</th>
                    <th ed-data="_edit" width="120px">操作</th>
                </tr>
                </thead>
            </table>
        </div>
    </div>
</div>

<div class="portlet light bordered edit" ng-show="roleGrid.edit">
    <div class="portlet-title">
        <div class="caption">
            <i class="icon-equalizer font-red-sunglo"></i>
            <span class="caption-subject font-red-sunglo bold uppercase">角色编辑</span>
        </div>
        <div class="actions">
            <a class="btn btn-circle btn-icon-only btn-default" href="javascript:;" ng-click="roleGrid.cancel();">
                <i class="icon-action-undo"></i>
            </a>
        </div>
    </div>

    <div class="portlet-body form">
        <!-- BEGIN FORM-->
        <form action="#" class="form-horizontal w5c-form" w5c-form-validate novalidate name="validateForm">
            <div class="form-body">
                <div class="form-group">
                    <label class="col-md-3 control-label">角色名称</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="role.roleName" name="roleName" required />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">所属部门</label>

                    <div class="col-md-4">
                        <input type="text" class="form-control" ng-model="dept.deptName" readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">数据范围</label>

                    <div class="col-md-4">
                        <select class="form-control" name="roleScope" ng-model="role.roleScope"
                                ng-options="opt.value as opt.name for opt in options.rolescope" required></select>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">角色备注</label>

                    <div class="col-md-4">
                        <textarea class="form-control" rows="3" ng-model="role.remark"></textarea>
                    </div>
                </div>
            </div>
            <div class="form-actions">
                <div class="row">
                    <div class="col-md-offset-3 col-md-4">
                        <button type="button" class="btn green" w5c-form-submit="roleGrid.save()"><i class="fa fa-save"></i> 保存</button>
                        <button type="button" class="btn default" ng-click="roleGrid.cancel();validateForm.reset();"><i class="fa fa-times"></i> 取消
                        </button>
                    </div>
                </div>
            </div>
        </form>
        <!-- END FORM-->
    </div>
</div>

<div ed-tips="roleInfo">
    <div style="float:left;font-size:28px;height:40px;line-height:40px;margin-right:18px;">{{role.roleName}}</div>
    <div style="float:left;color:#999">
        <div class="one-line" style="max-width:240px;margin-bottom:10px;margin-top:10px">{{role.deptName}}</div>
    </div>
    <div style="padding:6px 0px 3px 6px;border-bottom:1px solid #ccc;clear:both;">
        <h5>操作权限&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="btn btn-xs btn-edit" ng-click="editMenu()" ng-show="!menuEdit"><i class="fa fa-edit"></i> 编辑</button>
            <button class="btn btn-xs default" ng-click="cancelMenu()" ng-show="menuEdit"><i class="fa fa-times"></i> 返回</button>
        </h5>
    </div>
    <div class="ztree" style="overflow:auto;max-height:450px;clear: both" id="allMenuTree" ng-show="menuEdit"></div>
    <div class="ztree" style="overflow:auto;max-height:450px;clear: both" id="hasMenuTree" ng-show="!menuEdit"></div>

</div>